//--------------------------------------------------------------//
// Pass 0
//--------------------------------------------------------------//

float4x4 matViewProjection;
float4x4 world;

struct VS_INPUT 
{
   float4 Position : POSITION0;
   float2 TexCoord: TEXCOORD0;   
};

struct VS_OUTPUT 
{
   float4 Position : POSITION0;
   float2 TexCoord: TEXCOORD0;
};

VS_OUTPUT VS_MAIN( VS_INPUT Input )
{
   VS_OUTPUT Output;
   
   Output.Position = mul( Input.Position, world );
   Output.Position = mul( Output.Position, matViewProjection );
   Output.TexCoord = Input.TexCoord;
   
   return( Output );   
}

#define MUSTER_GROESSE 4.0

float4 PS_MAIN(VS_OUTPUT input) : COLOR0
{   
   float4 color;
   int musterX = (int)(input.TexCoord.x / MUSTER_GROESSE * 100.0);
   int musterY = (int)((input.TexCoord.y * 0.5) / MUSTER_GROESSE * 100.0);
   
   if(musterX % 2 == musterY % 2)
   {
      color = float4(0.0, 0.0, 0.0, 1.0);      
   }else
   {
      color = float4(1.0, 1.0, 1.0, 1.0);
   }

   

   return color;
}




//--------------------------------------------------------------//
// Technique Section for Schachbrett
//--------------------------------------------------------------//
technique Schachbrett
{
   pass Pass_0
   {
      VertexShader = compile vs_2_0 VS_MAIN();
      PixelShader = compile ps_2_0 PS_MAIN();
   }

}

